package tp.pr3;
/*
 * 
 * 
 * esta clase esta lista para la practica 3
 * 
 * 
 * */
import tp.pr3.commands.*;
import tp.pr3.commands.exceptions.WrongCommandFormatException;

public class Parser
{
	public Parser()
	{
		
	}	
	static private Command[] commandList=
	{
		new GoCommand(),
		new DropCommand(),
		new ExamineCommand(),
		new HelpCommand(),
		new LookCommand(),
		new PickCommand(),
		new QuitCommand(),
		new UseCommand(),
	};
	
	public static Command parseCommand(String line, Game executionContext)throws WrongCommandFormatException
    {
		for (Command comando : commandList)
		{
			try{
				return comando.parse(line, executionContext);
			}catch(Exception e){}
		}
		throw new WrongCommandFormatException("What?\n");                    
    }
	public static String getHelp() //modificado para practica 3
	{
		return ("You are lost. You are alone. You wander around\n"
				+ "Your command words are:\n" +
				"    EXAMINE|EXAMINAR\n"+
				"    GO|IR { NORTH|EAST|SOUTH|WEST }\n"+
				"    HELP|AYUDA\n"+
				"    LOOK|MIRA [<<id>>]\n"+
				"    PICK|COGER <<id>>\n"+
				"    DROP|SOLTAR <<id>>\n"+
				"    QUIT|SALIR\n"+
				"    USE |USAR<<id>>");
	}

}
